home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / EPSFileOptions.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.1 KB  |  116 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // Copyright (C) 1997-1999 Alias|Wavefront,
  18. // a division of Silicon Graphics Limited.
  19. //
  20. // The information in this file is provided for the exclusive use of the
  21. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  22. // and incorporate this code into other products for purposes authorized
  23. // by the Alias|Wavefront license agreement, without fee.
  24. //
  25. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  26. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  27. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  28. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  29. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  30. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  31. // PERFORMANCE OF THIS SOFTWARE.
  32. //
  33. global proc int EPSFileOptions ( string $parent, string $action,
  34.                                     string $initialOptions, string $resultCallback )
  35. //
  36. //    Description:
  37. //        This script posts the encapsulated postscript (EPS)  file accessor options.
  38. //
  39. //    Parameters:
  40. //        $parent    - the elf parent layout for this options layout. It is
  41. //                    always a scrollLayout.
  42. //        $action    - the action that is to be performed with this invokation
  43. //                    of this proc. Valid options are:
  44. //                        "query" - construct the options string and pass it
  45. //                                    to the resultCallback.
  46. //                        "post"    - post all the elf controls.
  47. //        $resultCallback    -
  48. //                This is the proc to be called with the result string. 
  49. //                resultCallback ( string $optionsString )
  50. //
  51. //    Returns:
  52. //        1 if successfull.
  53. //        0 otherwise.
  54. //
  55. {
  56.     int      $result;
  57.     string    $currentOptions;
  58.     string     $optionList[];
  59.     string     $optionBreakDown[];
  60.     int        $index;
  61.     
  62.     if ($action == "post") {
  63.         setUITemplate -pushTemplate DefaultTemplate;
  64.         setParent $parent;
  65.  
  66.         floatFieldGrp -l "Scale Factor" 
  67.             -v1 0 -pre 2 epsScaleFactorVal;
  68.                     
  69.         checkBoxGrp -l "Group" -l1 ""
  70.             -v1 1 epsGroupVal;
  71.                     
  72.         // Now set to current settings.
  73.         //
  74.         $currentOptions = $initialOptions;
  75.         if (size($currentOptions) > 0) {
  76.             tokenize($currentOptions, ";", $optionList);
  77.             for ($index = 0; $index < size($optionList); $index++) {
  78.                 tokenize($optionList[$index], "=", $optionBreakDown);
  79.                 if ($optionBreakDown[0] == "sc") {
  80.                     float $value = float( $optionBreakDown[1] );
  81.                     floatFieldGrp -e -v1 $value epsScaleFactorVal;
  82.                 }
  83.                 else if ($optionBreakDown[0] == "group") {
  84.                     int $value = 1;
  85.                     if( $optionBreakDown[1] == "on") {
  86.                         $value = 1;
  87.                     } else if( $optionBreakDown[1] == "off") {
  88.                         $value = 0;
  89.                     } else {
  90.                         $value = int( $optionBreakDown[1] );
  91.                     }
  92.                     if( $value > 0 ) {
  93.                         checkBoxGrp -e -v1 1 epsGroupVal;
  94.                     } else {
  95.                         checkBoxGrp -e -v1 0 epsGroupVal;
  96.                     }
  97.                 }
  98.             }
  99.         }
  100.         setUITemplate -popTemplate;
  101.  
  102.         $result = 1;
  103.     } else if ($action == "query") {
  104.         int $check = `checkBoxGrp -q -v1 epsGroupVal`;
  105.         float $value = `floatFieldGrp -q -v1 epsScaleFactorVal`;
  106.         $currentOptions = $currentOptions + "sc=" + $value;
  107.         $currentOptions += ";group=" + $check;
  108.         eval($resultCallback+" \""+$currentOptions+"\"");
  109.         $result = 1;
  110.     } else {
  111.         $result = 0;
  112.     }
  113.     
  114.     return $result;
  115. }
  116.